package com.jackrain.clouddata.oms.util;

import com.alibaba.fastjson.util.TypeUtils;
import com.jackrain.nea.core.db.Tools;
import com.jackrain.nea.web.query.QueryEngine;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 *
 * @Discription: 获取各表的 sequence
 * @Author cs
 * @Date 2017/4/27 10:07
 */
@Component
public class GetSequences {


    /**
     * 获取sequence
     *
     * @param tableName
     * @return
     */
    public Long getSequence(String tableName) {

        String sql = "select get_wsequences('" + tableName + "') as SEQ from dual";
        Long id = TypeUtils.castToLong(QueryEngine.getInstance().doQueryOne(sql));
        return id;
    }

}
